package main

type billLang map[string]string

var DataTypes = []string{}
var BillLangs = map[string]string{}

type BillTable struct {
	Columns   []BillColumn
	Name      string
	TableName string
}
type BillColumn struct {
	DefaultValue string
	Name         string
	IsPrimaryKey bool
	DataType     string
	MaxLength    uint
}
type BillViewTable struct {
	DataSource string
	Columns    []BillViewColumn
}
type BillViewColumn struct {
	BillColumn
	DataMember    string
	DisplaySource string
	IsFilter      bool
	DisplayFormat string
	Select        BillSelect
}
type BillSelect struct {
	DataSource string
}
type BillEditColumn struct {
	BillColumn
	DataMember string
	IsNotNull  bool
	IsReadOnly bool
	Select     BillSelect
	Lookup     BillLookup
}
type BillSourceGridColumn struct {
	DisplaySource string
	IsFilter      bool
	DisplayFormat string
	DataMember    string
}
type BillColumnMap struct {
	Name      string
	RefColumn string
}
type BillSelectSource struct {
	Name     string
	DataType string
	Options []struct {
		Value    string
		BillLang billLang
	}
}
type BillLookupSource struct {
	Name      string
	TableName string
	Columns []struct {
		Name         string
		IsPrimaryKey bool
		BillLang     billLang
	}
}
type BillLookup struct {
	DataSource string
	Columns []struct {
		LookupFieldName    string
		WritebackFieldName string
		IsFilter           bool
	}
}
type BillViewSource struct {
	Name      string
	TableName string
	AliasName string
	Join []struct {
		Relation  string
		TableName string
		AliasName string
		Condition string
	}
	DefaultValue  string
	IsFormatIndex bool
}
type BillTableViewColumn struct {
	Name         string
	RawName      string
	IsPrimaryKey bool
	BillLang     billLang
	DataType     string
}
type BillEditTable struct {
	Columns []BillEditColumn
}
type BillSourceStoreTable struct {
	DataSource string
	Columns    []BillSourceGridColumn
}
type StoreBill struct {
	BillNumberPrefix string
	ScmType          string
	ClientPlug       string
	Key              string
	ServicePlug      string
	BillLang         billLang
	DataSource struct {
		BillHead    BillTable
		BillEntity  BillTable
		LabelExpend BillTable
		ViewSources []BillViewSource
	}
	LookupSources []BillLookupSource
	SelectSource  []BillSelectSource
	Layout struct {
		ListPage struct {
			DataGrid BillViewTable
		}
		DetailPage struct {
			BillHead   BillEditTable
			BillEntity BillEditTable
		}
		MakingLabelListPage struct {
			SourceGrid BillSourceStoreTable
			StoreGrid  BillSourceStoreTable
		}
		MakingLabelEditPage struct {
			Mapping struct {
				Columns []struct {
					Name      string
					RefColumn string
				}
			}
			EditPanel struct {
				Columns []BillEditColumn
			}
		}
	}
}
